package code03_选择结构;

import java.util.Scanner;

/*
 * 提示用户输入三角形的边a、b、c，范围在[1,100]之间
 * 判断三角形的类型
 * 1.数据无效：a<0||a>100、b<0||b>100、c<0||c>100
 * 2.非三角形：a+b<=c或a+c<=b或b+c<=a
 * 3.等边：a=b=c
 * 4.等腰直角
 * 5.等腰：a=b或a=c或b=c
 * 6.直角：a*a+b*b=c*c或a*a+c*c=b*b或b*b+c*c=a*a
 * 7.普通
 */
public class 练习2 {
	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		System.out.println("请输入第一个数：");
		int a = input.nextInt();
		System.out.println("请输入第二个数：");
		int b = input.nextInt();
		System.out.println("请输入第三个数：");
		int c = input.nextInt();

		if (a < 0 || a > 100 || b < 0 || b > 100 || c < 0 || c > 100) {
			System.out.println("数据无效");
		} else {
			if (a + b <= c || a + c <= b || b + c <= a) {
				System.out.println("非三角形");
			} else {
				if (a == b && a == c) {
					System.out.println("等边三角形");
				} else if ((a == b && a * a + b * b == c * c) || (a == c && a * a + c * c == b * b)
						|| (b == c && b * b + c * c == a * a)) {
					System.out.println("等腰直角三角形");
				} else if (a == b || a == c || b == c) {
					System.out.println("等腰三角形");
				} else if ((a * a + b * b == c * c) || (a * a + c * c == b * b) || (b * b + c * c == a * a)) {
					System.out.println("直角三角形");
				} else {
					System.out.println("普通三角形");
				}
			}
		}
	}
}
